/***************************/
/*Bat dau chuc nang hien thi danh sach*/
function hienthids()
{
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="xlhienthids.php";
	xmlhttp.onreadystatechange=ds_stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
	
function ds_stateChanged()
{
	if (xmlhttp.readyState==4)
	{
		document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
	}
}
function capnhat(ma)
{
	var maso = ma;
	var tensanpham = document.getElementById(ma + " TenSanPham").value;
	var soluong = document.getElementById(ma + " SoLuong").value;
	var tinhtrangdang = document.getElementById(ma + " TinhTrangDang").value;
	var tinhtrangxoa = document.getElementById(ma + " TinhTrangXoa").value;
	var giasanpham = document.getElementById(ma + " GiaSanPham").value;
	
	xmlhttp=GetXmlHttpObject();
	if (xmlhttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}
	var url="xlcapnhat.php?MaSo=" + maso + "&TenSanPham=" + tensanpham + "&SoLuong=" + soluong + "&TinhTrangDang=" + tinhtrangdang  + "&TinhTrangXoa=" + tinhtrangxoa + "&GiaSanPham=" + giasanpham;
	xmlhttp.onreadystatechange=capnhat_stateChanged;
	xmlhttp.open("GET",url,true);
	//window.location = url;
	xmlhttp.send(null);
}
	
function capnhat_stateChanged()
{
	if (xmlhttp.readyState==4)
	{
		var response_stat=xmlhttp.responseText;
			
        if(response_stat == 1)
		{
			alert('Cap nhat thanh cong.');
			hienthids();
		}
		else
		{
			alert('Cap nhat that bai');
		}
	}
}
/*Ket thuc chuc nang hien thi danh sach**/
/*****/